//
//  YHCashRecordSubCell.m
//  YHApp
//
//  Created by -- on 2021/7/23.
//

#import "HACashRecordSubCell.h"
#import "HACashRecordMo.h"

@interface HACashRecordSubCell ()

/***/
@property (nonatomic, strong) UIView *mianView;
/***/
@property (nonatomic, strong) UIView *line1View;
/***/
@property (nonatomic, strong) UIView *line2View;
/***/
@property (nonatomic, strong) UILabel *tit1Label;
/***/
@property (nonatomic, strong) UILabel *con1Label;
/***/
@property (nonatomic, strong) UILabel *tit2Label;
/***/
@property (nonatomic, strong) UILabel *con2Label;
/***/
@property (nonatomic, strong) UILabel *tit3Label;
/***/
@property (nonatomic, strong) UILabel *con3Label;
/***/
@property (nonatomic, strong) UILabel *tit4Label;
/***/
@property (nonatomic, strong) UILabel *con4Label;
/***/
@property (nonatomic, strong) UILabel *tit5Label;
/***/
@property (nonatomic, strong) UILabel *con5Label;

@end

@implementation HACashRecordSubCell

-(void)setModel:(HACashRecordMo *)model {
    _model = model;
    
    self.con1Label.text = [NSString stringWithFormat:@"SO:%@",_model.sn];
    self.con2Label.text = [NSString stringWithFormat:@"￥%@",_model.amount];
    if (_model.acount_type == 1) {
        self.tit3Label.text = @"收款银行";
        self.con3Label.text = [NSString stringWithFormat:@"%@(尾号%@)",_model.bank,[_model.account substringWithRange:NSMakeRange(_model.account.length-4, 4)]];
    }else if (_model.acount_type == 2) {
        self.tit3Label.text = @"收款支付宝";
        self.con3Label.text = [NSString stringWithFormat:@"%@",_model.account];
    }
    self.con4Label.text = [NSString stringWithFormat:@"%@",_model.created_at];
    self.con5Label.text = [NSString stringWithFormat:@"%@",_model.state];
}

-(void)layoutSubviews {
    [super layoutSubviews];
    
    [self.mianView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(0);
        make.right.mas_equalTo(0);
        make.top.mas_equalTo(0);
        make.bottom.mas_equalTo(0);
    }];
    
    [self.line1View mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(15);
        make.right.mas_equalTo(-15);
        make.top.mas_equalTo(46);
        make.height.mas_offset(1);
    }];
    
    [self.line2View mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(15);
        make.right.mas_equalTo(-15);
        make.bottom.mas_equalTo(0);
        make.height.mas_offset(0.8);
    }];

    [self.tit1Label mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(15);
        make.height.mas_offset(20);
        make.width.mas_offset(88);
        make.top.mas_equalTo(13);
    }];
    
    [self.con1Label mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(-15);
        make.centerY.mas_equalTo(self.tit1Label);
    }];
    
    [self.tit2Label mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.line1View.mas_bottom).offset(15);
        make.height.mas_offset(20);
        make.width.mas_offset(88);
        make.left.mas_equalTo(15);
    }];
    
    [self.con2Label mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(-15);
        make.centerY.mas_equalTo(self.tit2Label);
    }];
    
    [self.tit3Label mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.tit2Label.mas_bottom).offset(15);
        make.height.mas_offset(20);
        make.width.mas_offset(88);
        make.left.mas_equalTo(15);
    }];
    
    [self.con3Label mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(-15);
        make.centerY.mas_equalTo(self.tit3Label);
    }];
    
    [self.tit4Label mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.con3Label.mas_bottom).offset(15);
        make.height.mas_offset(20);
        make.width.mas_offset(88);
        make.left.mas_equalTo(15);
    }];
    
    [self.con4Label mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(-15);
        make.centerY.mas_equalTo(self.tit4Label);
    }];

    [self.tit5Label mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.tit4Label.mas_bottom).offset(15);
        make.height.mas_offset(20);
        make.width.mas_offset(88);
        make.left.mas_equalTo(15);
    }];
    
    [self.con5Label mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(-15);
        make.centerY.mas_equalTo(self.tit5Label);
    }];


    
}

- (UIView *)mianView
{
    if (!_mianView) {
        _mianView = [UIView ha_createView];
        _mianView.backgroundColor = [UIColor whiteColor];
        [self.contentView addSubview:_mianView];
    }
    return _mianView;
}

- (UIView *)line1View
{
    if (!_line1View) {
        _line1View = [UIView ha_createView];
        _line1View.backgroundColor = [UIColor khaBGColor];
        [self.mianView addSubview:_line1View];
    }
    return _line1View;
}

- (UIView *)line2View
{
    if (!_line2View) {
        _line2View = [UIView ha_createView];
        _line2View.backgroundColor = [UIColor khaBGColor];
        [self.mianView addSubview:_line2View];
    }
    return _line2View;
}

- (UILabel *)tit1Label
{
    if (!_tit1Label) {
        _tit1Label = [UILabel ha_NLabelWithFont:19 textColor:@"#41485D" text:@"提现票据" alignment:0];
        [self.mianView addSubview:_tit1Label];
    }
    return _tit1Label;
}

- (UILabel *)con1Label
{
    if (!_con1Label) {
        _con1Label = [UILabel ha_NLabelWithFont:15 textColor:@"#41485D" text:@"" alignment:2];
        [self.mianView addSubview:_con1Label];
    }
    return _con1Label;
}

- (UILabel *)tit2Label
{
    if (!_tit2Label) {
        _tit2Label = [UILabel ha_NLabelWithFont:15 textColor:@"#858B9C" text:@"提现金额" alignment:0];
        [self.mianView addSubview:_tit2Label];
    }
    return _tit2Label;
}

- (UILabel *)con2Label
{
    if (!_con2Label) {
        _con2Label = [UILabel ha_NLabelWithFont:15 textColor:@"#41485D" text:@"" alignment:2];
        [self.mianView addSubview:_con2Label];
    }
    return _con2Label;
}

- (UILabel *)tit3Label
{
    if (!_tit3Label) {
        _tit3Label = [UILabel ha_NLabelWithFont:15 textColor:@"#858B9C" text:@"收款银行" alignment:0];
        [self.mianView addSubview:_tit3Label];
    }
    return _tit3Label;
}

- (UILabel *)con3Label
{
    if (!_con3Label) {
        _con3Label = [UILabel ha_NLabelWithFont:15 textColor:@"#41485D" text:@"" alignment:2];
        [self.mianView addSubview:_con3Label];
    }
    return _con3Label;
}

- (UILabel *)tit4Label
{
    if (!_tit4Label) {
        _tit4Label = [UILabel ha_NLabelWithFont:15 textColor:@"#858B9C" text:@"申请时间" alignment:0];
        [self.mianView addSubview:_tit4Label];
    }
    return _tit4Label;
}

- (UILabel *)con4Label
{
    if (!_con4Label) {
        _con4Label = [UILabel ha_NLabelWithFont:15 textColor:@"#41485D" text:@"" alignment:2];
        [self.mianView addSubview:_con4Label];
    }
    return _con4Label;
}

- (UILabel *)tit5Label
{
    if (!_tit5Label) {
        _tit5Label = [UILabel ha_NLabelWithFont:15 textColor:@"#858B9C" text:@"申请状态" alignment:0];
        [self.mianView addSubview:_tit5Label];
    }
    return _tit5Label;
}

- (UILabel *)con5Label
{
    if (!_con5Label) {
        _con5Label = [UILabel ha_NLabelWithFont:15 textColor:@"#41485D" text:@"" alignment:2];
        [self.mianView addSubview:_con5Label];
    }
    return _con5Label;
}

@end
